package aiguigu04.example.exer4;

/**
 * ClassName: MyArraysTest
 * Package: aiguigu04.example
 * Description:
 *
 * @Author ZY
 * @Create 2024/9/28 12:53
 * @Version 1.0
 */
public class MyArraysTest {
    public static void main(String[] args) {

        MyArrays arrs = new MyArrays();
        int[] arr = new int[]{34,56,223,2,56,24,56,67,788,45};

        //求最大值
        System.out.println("最大值为:" + arrs.getMax(arr));

        //求最小值
        System.out.println("最小值为:" + arrs.getMin(arr));

        //求平均值
        System.out.println("平均值为:" + arrs.getAvg(arr));

        //求总和
        System.out.println("总和为:" + arrs.getSum(arr));

        //遍历
        arrs.print(arr);

        //查找
        int index = arrs.linearSearch(arr,24);
        if (index >= 0){
            System.out.println("找到了，位置为:" + index);
        }else{
            System.out.println("未找到");
        }

        //排序
        arrs.sort(arr);
        //排序后遍历
        arrs.print(arr);
    }
}
